package com.promise.jokerdream.ui.settings

import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import com.promise.jokerdream.ui.components.SettingCard
import com.promise.jokerdream.ui.components.CheckboxOptionRow
import com.promise.jokerdream.ui.theme.AppSpacing
import com.promise.jokerdream.ui.theme.AppFontSizes
import com.promise.jokerdream.database.entity.WorldTreeGameConfigEntity

/**
 * 世界树设置卡片
 */
@Composable
fun WorldTreeSettingCard(
    config: WorldTreeGameConfigEntity,
    onWorldTreeChange: (Boolean) -> Unit,
    onCollectMaterialsChange: (Boolean) -> Unit,
    onFeedingChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    onExecuteClick: (() -> Unit)? = null
) {
    SettingCard(
        title = "世界树",
        description = "",
        checked = config.enabledSetting,
        onCheckedChange = onWorldTreeChange,
        modifier = modifier,
        onExecuteClick = onExecuteClick,
        content = {
            if (config.enabledSetting) {
                Column(
                    modifier = Modifier.fillMaxWidth()
                ) {
                    // 领材料功能
                    CheckboxOptionRow(
                        title = "领材料",
                        checked = config.collectMaterialsEnabled,
                        onCheckedChange = onCollectMaterialsChange
                    )
                    
                    // 喂养功能
                    CheckboxOptionRow(
                        title = "喂养",
                        checked = config.feedingEnabled,
                        onCheckedChange = onFeedingChange
                    )
                }
            }
        }
    )
}

